package cn.iocoder.yudao.module.trade.enums.order;

import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import java.util.Arrays;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 交易订单 - 审核状态
 *
 * @author cai
 */
@RequiredArgsConstructor
@Getter
public enum TradeOrderAuditStatusEnum implements IntArrayValuable {

    UN_AUDITED(0, "待审核"),
    AUDIT_PASSED(1, "审核通过"),
    AUDIT_UN_PASSED(2, "审核不通过");

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TradeOrderAuditStatusEnum::getStatus).toArray();

    /**
     * 状态值
     */
    private final Integer status;
    /**
     * 状态名
     */
    private final String name;

    @Override
    public int[] array() {
        return ARRAYS;
    }

    public static boolean isPassed(Integer type) {
        return ObjectUtil.equal(type, AUDIT_PASSED.getStatus());
    }

    public static boolean isUnAudited(Integer type) {
        return ObjectUtil.equal(type, UN_AUDITED.getStatus());
    }

}
